/* -----------------------------------------------------------
 * Author: Maria Powell
 * Testing Function: great_Hall()
 * Function Description: This function implements the 
 * 						 great_hall card.
 * 						 - add 1 card
 * 						 - add 1 action 
 * What to test: This test will ensure that the basic functionality
 * 				 of the card is tested.
 * How to test:  I will set the gameState and then test if it is
 * 				 properly set after playing the great hall card.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

//Set NOISY test to 0 to remove printfs from output console
#define NOISY_TEST 1

int main()
{
	//Initialization
	int i = 0;
	int firstPlayer = 0;
	int secondPlayer = 1;
	int numPlayers = 2;
	int handPos = 0;
	int currentHandCount = 0;
	int shouldBeHandCount = 0;
	int currentNumActions = 0;
	int shouldBeNumActions = 0;
	int addOneCard = 1;
	int toHand = 2;
	int seed = 1000;
	int notNeeded = 0;
	int k[10] = {adventurer, council_room, feast, gardens, mine,
				remodel, smithy, village, baron, great_hall};
	struct gameState G;

	printf("TESTING  great_hall()\n");
	#if (NOISY_TEST == 1)
		printf("Initializing gameState\n");
	#endif

	//set gameState
	memset(&G, 23, sizeof(struct gameState));
	initializeGame(numPlayers, k, seed, &G);

	//tracking hand count for first player
	currentHandCount = G.handCount[firstPlayer];
	shouldBeHandCount = currentHandCount + addOneCard;

	//tracking action number for first player
	currentNumActions = G.numActions;
	shouldBeNumActions = currentNumActions + addOneCard;

	//add great_hall card
	gainCard(great_hall, &G, toHand, firstPlayer);

	//set great_hall hand position
	for(i = 0; i < MAX_HAND; i ++)
	{
		if(G.hand[firstPlayer][i] == great_hall)
		{
			handPos = i;
		}
	}
	//play great_hall card
	cardEffect(great_hall, notNeeded, notNeeded, notNeeded, &G, handPos, &notNeeded);
	assert(G.handCount[firstPlayer] == shouldBeHandCount);
	assert(G.numActions == shouldBeNumActions);

	printf("Unit Test Passed\n");

	return 0;
}
